package com.educate.controller;

import com.educate.common.api.Result;
import com.educate.pojo.ProblemLike;
import com.educate.pojo.UserProblemLike;
import com.educate.service.ProblemLikeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 用户点赞接口
 * @author xiongyu
 * @date 2021/12/12 18:18
 */
@RestController
@RequestMapping("/problemLike")
@Slf4j
public class ProblemLikeController {
    @Autowired
    private ProblemLikeService problemLikeService;

    @DeleteMapping
    public Result deleteProblemLikeBash(@RequestBody List<Integer> userProblemLike) {
        return Result.success(problemLikeService.deleteProblemLikeBash(userProblemLike));
    }

    @PostMapping
    public Result addProblemLikeBash(@RequestBody List<ProblemLike> userProblemLike) {
        return Result.success(problemLikeService.addProblemLikeBash(userProblemLike));
    }

    @PutMapping
    public Result updateProblemLike(@RequestBody List<UserProblemLike> userProblemLikeList){
        return Result.success(problemLikeService.updateProblemLikeNumber(userProblemLikeList));
    }

}
